﻿// <copyright file="DoNamesMatchConverterTests.cs" company="Mooville">
//   Copyright © 2010 Roger Deetz. All rights reserved.
// </copyright>

namespace Mooville.QUno.ViewModel.Tests
{
    using System;
    using System.Globalization;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Mooville.QUno.ViewModel;

    [TestClass]
    public class DoNamesMatchConverterTests
    {
        [TestMethod]
        public void Constructor_ShouldNotThrow()
        {
            DoNamesMatchConverter target = new DoNamesMatchConverter();
            Assert.IsNotNull(target);

            return;
        }

        [TestMethod]
        public void Convert_GivenSameNames_ShouldReturnTrue()
        {
            DoNamesMatchConverter target = new DoNamesMatchConverter();
            string[] values = new string[2] { "Lucy", "Lucy" };
            object result = target.Convert(values, typeof(bool), null, CultureInfo.CurrentCulture);
            Assert.IsTrue((bool)result);

            return;
        }

        [TestMethod]
        public void Convert_GivenDifferentNames_ShouldReturnFalse()
        {
            DoNamesMatchConverter target = new DoNamesMatchConverter();
            string[] values = new string[2] { "Lucy", "Lainey" };
            object result = target.Convert(values, typeof(bool), null, CultureInfo.CurrentCulture);
            Assert.IsFalse((bool)result);

            return;
        }

        [TestMethod]
        public void Convert_GivenNullFirstName_ShouldReturnFalse()
        {
            DoNamesMatchConverter target = new DoNamesMatchConverter();
            string[] values = new string[2] { null, "Lainey" };
            object result = target.Convert(values, typeof(bool), null, CultureInfo.CurrentCulture);
            Assert.IsFalse((bool)result);

            return;
        }

        [TestMethod]
        public void Convert_GivenNullSecondName_ShouldReturnFalse()
        {
            DoNamesMatchConverter target = new DoNamesMatchConverter();
            string[] values = new string[2] { "Lucy", null };
            object result = target.Convert(values, typeof(bool), null, CultureInfo.CurrentCulture);
            Assert.IsFalse((bool)result);

            return;
        }

        [TestMethod]
        [ExpectedException(typeof(NotImplementedException))]
        public void ConvertBack_ShouldThrow()
        {
            DoNamesMatchConverter target = new DoNamesMatchConverter();
            target.ConvertBack(new object(), new Type[0], null, CultureInfo.CurrentCulture);

            return;
        }
    }
}
